feat(version): add MANUAL_VERSION, --next and --patch to version command#1724
Conversation
|
@Lee-W I already ran Do you have any ideas why this happen |
|
There was a way to run all the pre-commits, but I don't remember how it works 😅 |
|
Nice to see this going forward 🎉 |
54159ff to
34fb773
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1724 +/- ##
==========================================
+ Coverage 97.99% 98.10% +0.11%
==========================================
Files 60 61 +1
Lines 2691 2746 +55
==========================================
+ Hits 2637 2694 +57
+ Misses 54 52 -2 ☔ View full report in Codecov by Sentry. |
|
I will rebase this branch after #1726 is merged. The test failure should be resolved then. |
8d938d2 to
f9afbd4
Compare
f9afbd4 to
094f48b
Compare
3b48a33 to
b07121e
Compare
noirbizarre
left a comment
There was a problem hiding this comment.
That's an interesting feature, one that I would totally use!
Also, I never realized that the version command was doing totally different things depending on the flags 😅
So maybe it's the occasion to have a dedicated --version flag and have the version command focusing on the the project versioning and not the Commitizen version. It would be cleaner, easier to understand and more standard. WDYT ?
Note
I would not remove the Type aliases as it makes the PR bigger than it should and it introduce a breaking change (and reading the PR and issues, we know that it has been used by some users for some custom version schemes).
I would prefer to merge this before #1518 because it is a bit larger than this PR.
+1. As a user, I often run |
575468d to
3af1a57
Compare
4b6a441 to
c3d27c9
Compare
c3d27c9 to
cd857d8
Compare
|
@woile @noirbizarre @Lee-W |
|
There are some open conversations still |
5502285 to
4a9a5da
Compare
4a9a5da to
4482093
Compare
There was a problem hiding this comment.
Pull request overview
Adds new capabilities to the cz version command to support experimenting with version schemes by supplying a manual version, computing the “next” version, and outputting the patch component, with updated CLI help artifacts and tests.
Changes:
- Add
MANUAL_VERSIONpositional arg plus--nextand--patchoptions tocz version. - Introduce
VersionIncrementenum to model bump increments used by--next. - Update tests and CLI help snapshots/docs assets to reflect the new interface.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
commitizen/commands/version.py |
Implements MANUAL_VERSION, --next, and --patch behaviors in the version command. |
commitizen/cli.py |
Adds new CLI arguments/help text and updates usage for cz version. |
commitizen/version_increment.py |
Introduces VersionIncrement enum + helper casting used by --next. |
commitizen/version_schemes.py |
Adjusts typing around schemes/protocols and scheme loading. |
commitizen/tags.py |
Updates scheme/version typing usage within tag utilities. |
commitizen/out.py |
Broadens output helpers to accept non-string values safely. |
commitizen/commands/init.py |
Updates type hints to use VersionProtocol. |
commitizen/bump.py |
Updates type hints to use VersionProtocol. |
tests/commands/test_version_command.py |
Updates existing assertions and adds new tests for --next + manual version validation. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_10_version_.txt |
Updates CLI help snapshot for Python 3.10. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_11_version_.txt |
Updates CLI help snapshot for Python 3.11. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_12_version_.txt |
Updates CLI help snapshot for Python 3.12. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_13_version_.txt |
Updates CLI help snapshot for Python 3.13. |
tests/commands/test_common_command/test_command_shows_description_when_use_help_option_py_3_14_version_.txt |
Updates CLI help snapshot for Python 3.14. |
docs/images/cli_help/cz_version___help.svg |
Updates rendered CLI help image to match new options. |
docs/commands/version.md |
Touches documentation page for cz version (currently defers details via TODO). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…mand Rebased onto master: keep --tag with TagRules alongside the new flags. - Merge version command logic for manual/next/patch with tag normalization - Refresh help regression fixtures and cz version --help SVG - Fix TagRules.find_tag_for annotation (VersionProtocol) Closes commitizen-tools#1679 Made-with: Cursor
Argparse wraps the usage line differently before vs after Python 3.13, so separate regression baselines are required for CI matrix jobs. Made-with: Cursor
- Rename VersionIncrement.safe_cast to from_value; add tests - Map NONE to no bump; user-facing error for USE_GIT_COMMITS - Add tests for patch component, unknown scheme, and default output - Clarify get_version_scheme Protocol check; fix TagRules docstring example - Document MANUAL_VERSION, --next, and --patch; refresh help fixtures/SVG Made-with: Cursor
…ases Re-export VersionScheme = type[VersionProtocol] and Version = VersionProtocol for downstream custom schemes and parity with the public API on master. Import TypeAlias at runtime alongside Increment/Prerelease. Made-with: Cursor
55ee3b6 to
de820ac
Compare
- Parametrize invalid combination tests (major/minor/patch/tag without project) - Fix version scheme validation to use hasattr check instead of broken isinstance/issubclass on Protocol with non-method members - Format test file with ruff Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
de820ac to
1985e54
Compare
…ols#1678) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
I believe noirbizarre's blocking comment (unnecessary deletion of VersionScheme) is resolved.
Closes #1679
Manually tested and added test cases, the result LGTM.